package com.hushan.elevator.utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public final class Common {
    public static byte[] getFile(File file) {
        try (FileInputStream inputStream = new FileInputStream(file)) {
            byte[] bytes = new byte[inputStream.available()];
            inputStream.read(bytes, 0, inputStream.available());
            // 将字节转换为Base64字符串
            return bytes;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
